<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>

<body>
    <div id="app">
        <input type="button" value="点击" v-on:click="doIt">
        <input type="button" value="点击" @click="doIt">
        <h2 @click="change">{{ food }}</h2>
    </div>
    <script>
        var app = new Vue({
            el: "#app",
            data: {
                food: "西红柿"
            },
            methods: {
                doIt: function () {
                    alert("你好");
                },
                change: function () {
                    this.food += "你好";
                }
            }
        })
    </script>
</body>

</html>